<div navbar ng-init="currentItem='utils.process'"></div>
<div ng-show="!loaded">
    <div loading></div>
</div>

<div id="main" ng-show="loaded" style="display:none">
    <div class="module-header">
        <h3>进程管理</h3>
    </div>

    <div class="tabbable" ng-init="load()">
        <ul class="nav nav-tabs">
            <li ng-class="'active' | iftrue:activeTabName=='list'"><a href="#list" ng-click="tab_sec('list')" data-toggle="tab">进程列表</a></li>
            <li ng-class="'active' | iftrue:activeTabName=='other'"><a href="#other" ng-click="tab_sec('other')" data-toggle="tab">待续</a></li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane" ng-class="'active' | iftrue:activeTabName=='list'" id="list">
                <div class="well" ng-show="init_process">
                    <img src="images/loading.gif" style="margin-right: 5px;"> 正在加载列表，请稍候...
                </div>
                <div ng-show="!init_process">
                    <div class="pull-left">
                        <h5>进程列表</h5>
                    </div>
                    <div class="pull-right" ng-show="process && process.total">数量：{{process.total}}</div>
                    <table class="table table-hover table-bordered">
                        <thead>
                            <tr>
                                <th style="width:50px;" class="text-right">PID</th>
                                <th style="width:50px;">状态</th>
                                <th>名称</th>
                                <th>用户组</th>
                                <th>主目录</th>
                                <th>shell路径</th>
                                <th style="width:130px">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat="info in process.process">
                                <td class="text-right">{{info.pid}}</td>
                                <td ng-bind-html-unsafe="info.pid | process.status"></td>
                                <td>{{info.name}}</td>
                                <td>{{info.pid}}</td>
                                <td>{{info.pid}}</td>
                                <td>{{info.pid}}</td>
                                <td>
                                    <button class="btn btn-default btn-xs" ng-click="usermodconfirm($index)">详情</button>
                                    <button class="btn btn-default btn-xs" ng-click="processkillconfirm(info)">停止</button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="tab-pane" ng-class="'active' | iftrue:activeTabName=='other'" id="other">
                待开发功能
            </div>
        </div>
    </div>

</div>


<div id="processkillconfirm" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h3>停止进程 {{current_process.name}}</h3>
            </div>
            <div class="modal-body">
                <p>确定要停止进程 {{current_process.name}} [进程ID: {{current_process.pid}}] 吗？</p>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">取消</button>
                <button class="btn btn-danger" onclick="$('#processkillconfirm').modal('hide')" ng-click="processkill()">确认停止</button>
            </div>
        </div>
    </div>
</div>